﻿#region

using System.Collections.Generic;
using System.Linq;
using Minion.Win.Client.Models;
using Minion.Win.Client.ViewModels;

#endregion

namespace Minion.Win.Client.Helper
{
    public static class Converter
    {
        public static IList<LocationItemListViewModel> ConvertToLocationItemListViewModel(IList<Location> locations)
        {
            var viewModelList = new List<LocationItemListViewModel>();
            foreach (var location in locations)
            {
                viewModelList.AddRange(location.LocationItems.Select(locationItem => new LocationItemListViewModel
                    {
                        Id = locationItem.Id, ItemTitle = locationItem.ItemTitle, ItemDescription = locationItem.ItemDescription, ItemType = locationItem.ItemType
                    }));
            }
            return viewModelList;
        }
    }
}